/*
 * @Author: szx
 * @Date: 2021-11-07 13:51:48
 * @LastEditTime: 2021-11-07 13:54:37
 * @Description:
 * @FilePath: \leetcode\100-199\191\191.cpp
 */
#include <iostream>
using namespace std;
class Solution {
   public:
    int hammingWeight(uint32_t n) {
        int ret = 0;
        for (int i = 0; i < 32; i++) {
            if (n & (1 << i)) {
                ret++;
            }
        }
        return ret;
    }
};